import 'package:flutter/material.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:xiongan_app_yy/common/user_singleton.dart';
import 'package:xiongan_app_yy/utils/ImageDetailsUtils.dart';
import 'package:xiongan_app_yy/widgets/comm/left_icon_widget.dart';

//下载二维码
class DownloadCodePage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return DownloadCodeState();
  }
}

class DownloadCodeState extends State<DownloadCodePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: new AppBar(
        backgroundColor: Color(0XFF00A5F1),
        automaticallyImplyLeading: false,
        //设置没有返回按钮
        title: Text(
          "下载二维码",
          style: TextStyle(fontSize: 18),
        ),
        elevation: 0,
        centerTitle: true,
        leading: LeftIconWidget(icon: Icons.chevron_left, isize: 36),
      ),
      body: Column(
        children: <Widget>[
          Container(
            width: double.infinity,
            height: 339,
            margin: EdgeInsets.only(left: 20, right: 20, top: 50),
            child: new ClipRRect(
              borderRadius: BorderRadius.circular(10),
              child: Container(
                color: Colors.white,
                alignment: Alignment.center,
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: <Widget>[
                    Container(
                      height: 250,
                      child: Center(
                        child: GestureDetector(
                          child: QrImage(
                            data: DataSingleton().Data.id,
                            version: QrVersions.auto,
                          ),
                          onTap: () {
                            ImageDetailsUtils.jumpImageDetails(
                                context, DataSingleton().Data.id, true);
                          },
                        ),
                      ),
                    ),
                    Text(
                      "扫描二维码，下载APP",
                      style: TextStyle(fontSize: 11),
                    )
                  ],
                ),
              ),
            ),
          ),
        ],
      ),
    );
  }
}
